package com.cfx.exercise_45;

import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URL;

import org.junit.Test;

/*
 * 如何准确的定位网络上的一台或多台主机
 * 找到主机后如何可靠高效地进行数据传输
 */
public class TestSocket {

	public static void main(String[] args) throws Throwable {

		URL url = new URL("http://localhost:8080/mysql-5.5.54-winx64.zip");
		InputStream is = url.openStream();
		FileOutputStream fos = new FileOutputStream("C:/Users/zs/Desktop/mysql-5.5.54-winx64.zip");
		byte[] b = new byte[1024];
		int len = 0;
		while((len = is.read(b))!= -1){
			fos.write(b, 0, len);
		}
		fos.close();
		is.close();
		
	}
	@Test
	public void client() throws Throwable{
		
		
		
	}
	@Test
	public void server() throws Throwable{
		
		
		
		
	}
}
